export {};

class Person {
    protected name: string;
    public age: number;

    constructor(name: string, age: number) {
        this.name = name;
        this.age = age;
    }

    introduce(): string {
        return `name: ${this.name}, age: ${this.age}`;
    }
}

class Stu extends Person {
    clsNum: number;

    constructor(name: string, age: number, clsNum: number) {
        super(name, age);
        this.clsNum = clsNum;
    }

    introduce(): string {
        // if (this.age > 20) {
        //     return super.introduce();
        // }
        return `name: ${this.name}, age: ${this.age}, clsNum: ${this.clsNum}`;
    }
}

let stu: Person = new Stu("xue", 30, 11);
console.log(stu.introduce());
let stu1: Stu = new Stu("xue", 31, 11);
console.log(stu1.introduce());
